Skip to content

Kirpichev's Homework#9

Open
Haaaydn wants to merge 13 commits intoDafeCpp:mainfrom
Haaaydn:main
Open

Kirpichev's Homework#9
Haaaydn wants to merge 13 commits intoDafeCpp:mainfrom
Haaaydn:main

Conversation

@Haaaydn
Copy link
Copy Markdown

@Haaaydn Haaaydn commented Apr 26, 2025

No description provided.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Comment thread task_06/src/k_stat.cpp Outdated
#include <iostream>

int Partition(std::vector<int>& arr, int left, int right) {
int pivotIndex = left + rand() % (right - left + 1);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Division by zero [clang-analyzer-core.DivideZero]

  int pivotIndex = left + rand() % (right - left + 1);
                                 ^
Additional context

task_06/src/k_stat.cpp:38: Assuming 'n' is >= 0

  if (n < 0 || n >= arr.size()) {
      ^

task_06/src/k_stat.cpp:38: Left side of '||' is false

  if (n < 0 || n >= arr.size()) {
      ^

task_06/src/k_stat.cpp:38: Assuming the condition is false

  if (n < 0 || n >= arr.size()) {
               ^

task_06/src/k_stat.cpp:38: Taking false branch

  if (n < 0 || n >= arr.size()) {
  ^

task_06/src/k_stat.cpp:42: Calling 'quick_select'

  return quick_select(arr, 0, arr.size() - 1, n);
         ^

task_06/src/k_stat.cpp:25: Assuming 'left' is not equal to 'right'

  if (left == right) return arr[left];
      ^

task_06/src/k_stat.cpp:25: Taking false branch

  if (left == right) return arr[left];
  ^

task_06/src/k_stat.cpp:29: Assuming 'k' is not equal to 'pivotIndex'

  if (k == pivotIndex)
      ^

task_06/src/k_stat.cpp:29: Taking false branch

  if (k == pivotIndex)
  ^

task_06/src/k_stat.cpp:31: Assuming 'k' is >= 'pivotIndex'

  else if (k < pivotIndex)
           ^

task_06/src/k_stat.cpp:31: Taking false branch

  else if (k < pivotIndex)
       ^

task_06/src/k_stat.cpp:34: Calling 'quick_select'

    return quick_select(arr, pivotIndex + 1, right, k);
           ^

task_06/src/k_stat.cpp:25: 'left' is not equal to 'right'

  if (left == right) return arr[left];
      ^

task_06/src/k_stat.cpp:25: Taking false branch

  if (left == right) return arr[left];
  ^

task_06/src/k_stat.cpp:27: Calling 'Partition'

  int pivotIndex = Partition(arr, left, right);
                   ^

task_06/src/k_stat.cpp:7: Division by zero

  int pivotIndex = left + rand() % (right - left + 1);
                                 ^

Comment thread task_06/src/k_stat.cpp Outdated

int find_k_stat(std::vector<int>& arr, int n) {
if (n < 0 || n >= arr.size()) {
std::cerr << "Invalid n: out of bounds!" << std::endl;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]

Suggested change
std::cerr << "Invalid n: out of bounds!" << std::endl;
std::cerr << "Invalid n: out of bounds!" << '\n';

@github-actions
Copy link
Copy Markdown

clang-tidy review says "All clean, LGTM! 👍"

@github-actions
Copy link
Copy Markdown

clang-tidy review says "All clean, LGTM! 👍"

…ртировку (всего 18), а также три теста на поиск K-той порядеовой статистики
@github-actions
Copy link
Copy Markdown

clang-tidy review says "All clean, LGTM! 👍"

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2025

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Comment thread task_01/src/sum_two_num.h
@@ -0,0 +1,3 @@
#include <vector>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'vector' file not found [clang-diagnostic-error]

#include <vector>
         ^

Comment thread task_01/src/test.cpp Outdated

#include "sum_two_num.h"

std::string captureOutput(std::vector<int>& vec, int len, int num) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'captureOutput' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]

Suggested change
std::string captureOutput(std::vector<int>& vec, int len, int num) {
static std::string captureOutput(std::vector<int>& vec, int len, int num) {

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Comment thread task_01/src/test.cpp

#include "sum_two_num.h"

static std::string captureOutput(std::vector<int>& vec, int len, int num) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'captureOutput' declared 'static', move to anonymous namespace instead [misc-use-anonymous-namespace]

static std::string captureOutput(std::vector<int>& vec, int len, int num) {
                   ^

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Comment thread task_07/src/tree.h
#ifndef AVL_TREE_H
#define AVL_TREE_H

#include <algorithm>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'algorithm' file not found [clang-diagnostic-error]

#include <algorithm>
         ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant